import request from '../utils/request'

// 心理提问类型定义
export interface MessageBoard {
  issueId: number
  text: string
  createrId: number
  createTime: string
  createrName?: string // 前端展示需要
  status?: number // 前端展示需要 0-待回答 1-已回答
  messageCount?: number // 前端展示需要
}

// 获取提问列表
export const getMessageBoardList = () => {
  return request<{
    code: string
    msg: string
    total: number
    data: MessageBoard[]
  }>({
    url: '/message-board/list',
    method: 'get'
  })
}

// 发布提问
export const createMessageBoard = (data: {
  creatorId: number
  text: string
}) => {
  return request({
    url: '/message-board/create',
    method: 'post',
    params:data
  })
}

// 获取提问详情
export const getMessageBoardDetail = (issueId: number) => {
  return request<{
    code: string
    msg: string
    total: number
    data: MessageBoard
  }>({
    url: `/message-board/detail/${issueId}`,
    method: 'get'
  })
}
